
#include <iostream>
#include <stack>
#include <string>

using namespace std;

bool is(char o, char cl) {
    return (o == '(' && cl == ')') ||
           (o == '[' && cl == ']') ||
           (o == '{' && cl == '}');
}

bool ch(string b) {
    stack<char> x;
    for (char c : b) {
        if (c == '(' || c == '[' || c == '{') {
            x.push(c);
        } else if (c == ')' || c == ']' || c == '}') {
            if (x.empty() || !is(x.top(), c)) {
                return false;
            }
            x.pop();
        }
    }
    return x.empty();
}

int main() {
    string input ;
    cin>>input;
    if (ch(input)) {
        cout << "True" << endl;
    } else {
        cout << "False" << endl;
    }
    return 0;

}

